<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>编辑企业新员工三级安全教育</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="__ADMIN__/css/font.css">
        <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
        <script src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>

        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <style type="text/css">
        .left_title{width: 200px;}
    </style>
    </head>
    
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" method="post" action="" enctype="multipart/form-data">
                    <div class="layui-form-item">
                        <label for="company_id" class="layui-form-label left_title">
                            <span class="x-red">*</span>企业名称：</label>
                        <div class="layui-input-inline">
                            <select name="company_id" class="valid">
                                <option value="">请选择</option>
                                <foreach name="company" item="v">
                                    <option value="<{$v['id']}>" <if condition='$info["company_id"] eq $v["id"]'>selected=""</if>><{$v['name']}></option>
                                </foreach>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="name" class="layui-form-label left_title">
                            <span class="x-red">*</span>员工姓名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="name" placeholder="员工姓名" value="<{$info.name}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="sex" class="layui-form-label left_title">
                            <span class="x-red">*</span>性别：</label>
                        <div class="layui-input-block">
                              <input type="radio" name="sex"  value="1" title="男"<if condition='$info["sex"] eq 1'>checked</if>>
                              <input type="radio" name="sex"  value="2" title="女"<if condition='$info["sex"] eq 2'>checked</if>>
                            </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="position" class="layui-form-label left_title">
                            <span class="x-red">*</span>职务：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="position" placeholder="职务" value="<{$info.position}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="factory_time" class="layui-form-label left_title">
                            <span class="x-red">*</span>入厂时间：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="factory_time" placeholder="入厂时间" value="<{$info.factory_time}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="workshop" class="layui-form-label left_title">
                            <span class="x-red">*</span>所在车间/部门：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="workshop" placeholder="所在车间/部门" value="<{$info.workshop}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="card_id" class="layui-form-label left_title">
                            <span class="x-red">*</span>身份证号：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="card_id" placeholder="身份证号" value="<{$info.card_id}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="phone" class="layui-form-label left_title">
                            <span class="x-red">*</span>联系电话：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="phone" placeholder="联系电话" value="<{$info.phone}>" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="is_special" class="layui-form-label left_title">
                            <span class="x-red">*</span>是否特种作业人员：</label>
                        <div class="layui-input-block">
                              <input type="radio" name="is_special"  value="1" title="是"<if condition='$info["is_special"] eq 1'>checked</if>>
                              <input type="radio" name="is_special"  value="2" title="否"<if condition='$info["is_special"] eq 2'>checked</if>>
                            </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="kind" class="layui-form-label left_title">
                            <span class="x-red">*</span>证书种类：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="kind" placeholder="证书种类" value="<{$info.kind}>" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="license_date" class="layui-form-label left_title">
                            <span class="x-red">*</span>领证日期：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="license_date" placeholder="领证日期" value="<{$info.license_date}>" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="review_date" class="layui-form-label left_title">
                            <span class="x-red">*</span>复审日期：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="review_date" placeholder="复审日期" value="<{$info.review_date}>" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="kind" class="layui-form-label left_title">
                            <span class="x-red">*</span>证书种类：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="kind" placeholder="证书种类" value="<{$info.kind}>" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="company_level" class="layui-form-label left_title">
                            <span class="x-red">*</span>公司级考核结果：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="company_level" value="<{$info.company_level}>" placeholder="公司级考核结果" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="workshop_level" class="layui-form-label left_title">
                            <span class="x-red">*</span>车间级考核结果：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="workshop_level" value="<{$info.workshop_level}>" placeholder="车间级考核结果" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="team_level" class="layui-form-label left_title">
                            <span class="x-red">*</span>班组级考核结果：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="team_level" value="<{$info.team_level}>" placeholder="班组级考核结果" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="train_img" class="layui-form-label left_title">
                            培训证明材料：</label>     
                            <div class="layui-upload-drag " id="uploadBanner" >
                        <img class="layui-upload-img" id="upload-photo">
                        <i class="layui-icon" id="upload-icon"></i>
                        <p>点击上传</p>
                    </div>
                    <div class="layui-input-inline">
                     <input type="text" id="res" name="train_img" value="<{$images}>" class="layui-input"   />
                     </div>
                    </div>
                    <input type="hidden" name="id" value="<{$info.id}>">
		        <div class="layui-form-item">
		            <label for="L_repass" class="layui-form-label left_title"></label>
		            <button class="layui-btn" lay-filter="edit" lay-submit="">提交</button>
		        </div>
        </form>
        </div>
        </div>
        <script type="text/javascript" src="__COMMON__/js/jquery-2.0.3.min.js"></script>
	<script>
        layui.use('upload', function(){
    var $ = layui.jquery
        ,upload = layui.upload;
      
    //普通图片上传
    var uploadInst = upload.render({
        elem: '#uploadBanner'
        ,url: '<{:U('Position/doUploadPic')}>'
        ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
                $('#upload-photo').attr('src', result); //图片链接（base64）
                $('#upload-photo').attr('style', 'height:3rem;');
                $('#upload-icon').attr('style','display:none;');
            });
        }
        ,done: function(res, index, upload){
            //如果上传失败
            if(res.code > 0){
                return layer.msg('上传失败');
            }
            $("#res").val(res.data.src);
            //上传成功
            //console.log("成功啦！" + obj2string(res) + "    " + index + "    " + upload);
        }
        ,error: function(){
            //演示失败状态，并实现重传
            var demoText = $('#demoText');
            demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
            demoText.find('.demo-reload').on('click', function(){
                uploadInst.upload();
            });
        }
    });
});
        

		layui.use(['form', 'layedit', 'laydate'], function(){
			var form = layui.form
			,layer = layui.layer
			,layedit = layui.layedit
			,laydate = layui.laydate;


			//监听提交
			form.on('submit(edit)', function(data){
				$.ajax({
					url:'<{:U('Wisdom/edit_safety_education')}>',
					type:"post",
					data:data.field,
					dataType:"json",
					success:function(data){
						if (data.status==1) {
							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
							//父级页面提示成功信息
							parent.layer.msg(data.info,{
									icon:1,
									time:2000
							    }, function(){
	  								parent.layer.close(index);//关闭弹出的子页面窗口
									parent.location.reload();//刷新父级页面
								});
							
						}else{
							layer.msg(data.info,{anim: 6});//错误提示
						}
					},
				});
				return false;
			});
			
		});
		
	</script>

    </body>

</html>